-
Notifications
You must be signed in to change notification settings - Fork 2.1k
virtio-balloon: Add free page reporting hinting #5491
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
JackThomson2
wants to merge
10
commits into
firecracker-microvm:main
Choose a base branch
from
JackThomson2:free_page_hinting_reporting
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
virtio-balloon: Add free page reporting hinting #5491
JackThomson2
wants to merge
10
commits into
firecracker-microvm:main
from
JackThomson2:free_page_hinting_reporting
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
c96f7be to
8ef7916
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5491 +/- ##
========================================
Coverage 82.87% 82.88%
========================================
Files 270 270
Lines 27780 28104 +324
========================================
+ Hits 23024 23294 +270
- Misses 4756 4810 +54
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
5a1b473 to
8dcf4fd
Compare
kalyazin
reviewed
Oct 30, 2025
f42d9b2 to
f1fdada
Compare
ShadowCurse
reviewed
Nov 17, 2025
38989b3 to
32e3e43
Compare
32e3e43 to
1c8435e
Compare
Free page reporting is a mechanism in which the guest will notify the host of pages which are not currently in use. This feature can only be configured on boot and will continue to report continuously. With free page reporting firecracker will `MADV_DONTNEED` on the ranges reported. This allows the host to free up memory and reduce the RSS of the VM. With UFFD this is sent as the `UFFD_EVENT_REMOVE` after the call with `MADV_DONTNEED`. Signed-off-by: Jack Thomson <[email protected]>
Free page hinting is a mechanism which allows the guest driver to report ranges of pages to the host device. A "hinting" run is triggered by the device by issuing a new command id in the config space, after the update to the id the device will hint ranges to the host which are unused. Once the driver has exhausted all free ranges it notifies the device the run has completed. The device can then issue another command allowing the guest to reclaim these pages. Adding support for hinting the firecracker balloon device, we offer three points to manage the device; first to start a run, second to monitor the status and a final to issue the command to allow the guest to reclaim pages. To note, there is a potential condition in the linux driver which would allow a range to be reclaimed in an oom scenario before we remove the range. Signed-off-by: Jack Thomson <[email protected]>
Adding API endpoints to manage free page hinting . With three different endpoint: Start - To begin a new run for free page hinting, Status - To track the state of the hinting run, Stop - To stop the hinting run and allow the guest to reclaim the pages reported. Signed-off-by: Jack Thomson <[email protected]>
Add metrics to track free page hinting and reporting. For both devices track the number of ranges reported, the number of errors encountered while freeing and the total amount of memory freed. Signed-off-by: Jack Thomson <[email protected]>
Adding new resources to the http api to enable testing of the hinting functionality. Signed-off-by: Jack Thomson <[email protected]>
Add option for fast_page_fault_helper to run in a oneshot mode, that doesn't require the signal to be triggered before measuring the fault latency. This makes it possible to test fault latency on non-snapshotted vms as only the first fault is measured. Signed-off-by: Jack Thomson <[email protected]>
Add integration tests for free page hinting and reporting, both functional and performance tests. New functional tests to ensure that hinting and reporting are reducing the RSS as expected in the guest. Updated reduce RSS test to touch memory to reduce the chance of flakiness. New performance tests for the balloon device. First being a test to track the CPU overhead of hinting and reporting. Second being a test to measure the faulting latency while reporting is running in the guest. Signed-off-by: Jack Thomson <[email protected]>
Add integration tests for free page hinting and reporting. Asserting the features are enabled correctly. Testing the config space updates triggered by hinting are being set as expected. Signed-off-by: Jack Thomson <[email protected]>
While the traditional balloon device would not be able to reclaim memory when back by huge pages, it could still technically be used to to restrict memory usage in the guest. With the addition of hinting and reporting, they report ranges in bigger sizes (4mb by default). Because of this, it is possible for the host reclaim huge pages backing the guest. Updates the performance tests for the balloon when back by huge pages, added varients to the size reduction tests to ensure hinting and reporting can reduce the RSS of the guest. Move the inflation test to performance to ensure it runs sequentially in CI otherwise the host can be exhausted of huge pages. Signed-off-by: Jack Thomson <[email protected]>
Update docs to reflect that now huge pages can be used alongside the traditional balloon device. However, note the caveat that memory may not be reclaimed from the guest. Signed-off-by: Jack Thomson <[email protected]>
1c8435e to
943dfde
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Adding support for virtio-balloon features: Free page hinting and reporting.
TODO
Update documentation on the update balloon features
Update release notes
...
Reason
...
License Acceptance
By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache 2.0 license. For more information on following Developer
Certificate of Origin and signing off your commits, please check
CONTRIBUTING.md.PR Checklist
tools/devtool checkbuild --allto verify that the PR passesbuild checks on all supported architectures.
tools/devtool checkstyleto verify that the PR passes theautomated style checks.
how they are solving the problem in a clear and encompassing way.
in the PR.
CHANGELOG.md.Runbook for Firecracker API changes.
integration tests.
TODO.rust-vmm.